package com.andaily.domain.account;

/**
 * @author Shengzhao Li
 */
public enum AccountKind {

    INCOME("收入"),
    EXPENDITURE("支出");

    private String name;

    AccountKind(String name) {
        this.name = name;
    }

    public String getDisplayName() {
        return name;
    }

    /**
     * get Name
     *
     * @return name
     */
    public String getName() {
        return name();
    }

    /**
     * Get kind by name
     *
     * @param name name
     * @return AccountKind
     */
    public static AccountKind getKind(String name) {
        for (AccountKind kind : values()) {
            if (kind.name().equalsIgnoreCase(name)) {
                return kind;
            }
        }
        return null;
    }

    /**
     * Check current kind is or not EXPENDITURE.
     *
     * @param kind AccountKind
     * @return true is EXPENDITURE
     */
    public static boolean isExpenditure(AccountKind kind) {
        return AccountKind.EXPENDITURE.equals(kind);
    }
}
